/**
 * COPYRIGHT HangZhou Trustway Technology Company Limited
 * All right reserved.
 */
package com.zfsmart.component.common.util;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jws;
import io.jsonwebtoken.Jwts;
import lombok.Data;

/**
 * @Description token加密工具
 * @Author 薛铁琪
 * @CreateTime 2019-06-24 18:11
 * @Version 1.0
 */
@Data
public class TokenDecoder {
    private String key;

    public String validateAndGet(String token) {
        Jws<Claims> jws = null;
        jws = Jwts.parser().setSigningKey(key).parseClaimsJws(token);
        return jws.getBody().getSubject();
    }
}
